<script>
$(function(){
    $("#group").change(function () {
        var group = $(this).val();
        select_pid(group)
    });
    var id={:input('id', 0)};
    if(id == 0){
        select_pid($("#group").val());
    }
});
function select_pid(group){
    var pid = {:input('pid', 0)};
    if(pid > 0){
        return ;
    }

    $.ajax({
        type: "POST",
        url: "{:url('admin/user/grouplist')}",
        data: {'group':group},
        dataType: "json",
        success: function(data){
            $("#situation").html('');
            if(data.code==0){
                var array = data.data;
                $("#situation").append("<option value='0'>请选择岗位</option>")
                array.forEach(e => {
                    $("#situation").append("<option value='"+e.id+"'>"+e.title+"</option>");
                });
                
            }else{
                updateAlert(data.msg, 'danger');
            }
        },
        error : function(e){
            console.log(e.status);
            console.log(e.responseText);
        }
    })
}
</script>